import Vue from 'vue'
import VueRouter from "vue-router";

import Layout from '@/views/Layout'
import ArticleDetail from '@/views/ArticleDetail'
import Article from '@/views/Article'
import Collect from '@/views/Collect'
import Like from '@/views/Like'
import User from '@/views/User'

Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
    // 配置一级路由
    // { path: '/', redirect: '/layout' },
    {
      path: '/',
      component: Layout,
      // 配置首页版块的二级路由
      // 二级路由也要有路由出口
      children: [
        { path: '/', redirect: '/article' },
        { path: 'article', component: Article }, // /article
        { path: 'collect', component: Collect }, // /collect
        { path: 'like', component: Like },
        { path: 'user', component: User }
      ]
    },
    { path: '/detail/:id', component: ArticleDetail },
  ]
})

export default router